#### Results with full names ####
# CA local elections
mod_ced_fullname_pro <- lm(formula(paste(dv_ced, "~", iv_full_name_algorithm, "+", ced_controls)),
                           data = ced)
ced_pro_r2 <- get_r2(mod_ced_fullname_pro)
mod_ced_fullname_pro <- get_clusters(mod_ced_fullname_pro)

mod_ced_fullname_common <- lm(formula(paste(dv_ced, "~", iv_full_name_commonality, "+", ced_controls)),
                              data = ced)
ced_common_r2 <- get_r2(mod_ced_fullname_common)
mod_ced_fullname_common <- get_clusters(mod_ced_fullname_common)

# Primary congressional elections
mod_primary_fullname_pro <- lm(formula(paste(dv_prim, "~", iv_full_name_algorithm, "+", primary_controls)),
                               data = primary)

primary_pro_r2 <- get_r2(mod_primary_fullname_pro)
mod_primary_fullname_pro <- get_clusters(mod_primary_fullname_pro)

mod_primary_fullname_common <- lm(formula(paste(dv_prim, "~", iv_full_name_commonality, "+", primary_controls)),
                                  data = primary)

primary_common_r2 <- get_r2(mod_primary_fullname_common)
mod_primary_fullname_common <- get_clusters(mod_primary_fullname_common)

# General congressional elections
mod_general_fullname_pro <- lm(formula(paste(dv_gen, "~", iv_full_name_algorithm, "+", general_controls)),
                               data = general)

general_pro_r2 <- get_r2(mod_general_fullname_pro)
mod_general_fullname_pro <- get_clusters(mod_general_fullname_pro)

mod_general_fullname_common <- lm(formula(paste(dv_gen, "~", iv_full_name_commonality, "+", general_controls)),
                                  data = general)

general_common_r2 <- get_r2(mod_general_fullname_common)
mod_general_fullname_common <- get_clusters(mod_general_fullname_common)

mods <- list(mod_general_fullname_pro, mod_general_fullname_common, mod_primary_fullname_pro, mod_primary_fullname_common, mod_ced_fullname_pro, mod_ced_fullname_common)

stargazer(mods,
          type = "latex",
          title = "Relationship Between Name Fluency and Vote Share",
          style = style,
          star.cutoffs = star.cutoffs,
          star.char = star.char,
          column.labels = column.labels,
          column.separate = c(2, 2, 2),
          keep.stat = keep.stat,
          notes = notes,
          keep = c("full_name_algorithm",
                   "full_name_commonality",
                   "white",
                   "incumbent",
                   "female",
                   "lchars",
                   "fchars",
                   "race",
                   "num_prim_opps",
                   "totvotes1000",
                   "office",
                   "seats_comps"),
          covariate.labels = c("Full Name Pronounceability",
                               "Full Name Commonality",
                               "White",
                               "Incumbent",
                               "Female",
                               "Surname Length",
                               "First Name Length",
                               "Senate Election",
                               "Number of Primary Opponents",
                               "Total Election Votes/1000",
                               "School Board Election",
                               "Seats/Competitors"),
          font.size = "footnotesize",
          model.names = F,
          add.lines=list(c("Year FE", "\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark"),
                         c("State FE", "\\checkmark", "\\checkmark", "\\checkmark", "\\checkmark", "", ""),
                         c("County FE", "", "", "", "", "\\checkmark"),
                         c("N", get_n(mod_general_fullname_pro), get_n(mod_general_fullname_common), get_n(mod_primary_fullname_pro), get_n(mod_primary_fullname_common), get_n(mod_ced_fullname_pro), get_n(mod_ced_fullname_common)),
                         c("Adj. R-squared", general_pro_r2, general_common_r2, primary_pro_r2, primary_common_r2, ced_pro_r2, ced_common_r2)),
          out = "Tables/reg-fullnames.tex",
          label = "tab:reg-fullnames")
